<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      ul,
      li {
        list-style: none;
      }
      .wrap {
        width: 100%;
      }
      .wrap > ul {
        width: 100%;
        display: flex;
        /* justify-content: space-evenly;
        align-items: center; */
        flex-wrap: wrap;
        background-color: #ccc;
      }
      .wrap > ul > li {
        width: 400px;
        height: 500px;
        margin: 10px 0;
      }
      .wrap > ul > li > img {
        width: 100%;
        height: 100%;
      }
      button {
        position: fixed;
        right: 20px;
        bottom: 20px;
        width: 50px;
        height: 30px;
        background-color: yellowgreen;
        color: #000;
      }
    </style>
  </head>
  <body>
    <div class="wrap">
      <ul>
        <!-- <li><img src="" /></li> -->
      </ul>
    </div>
    <button onclick="Next()">下一页</button>
  </body>
  <script>
    function createFn(num = 1) {
      let xhr = new XMLHttpRequest();
      let url = `https://api5.hanfuhui.com/Product/GetProductListPublic?count=20&page=${num}`;
      xhr.open("GET", url);
      xhr.send();
      //   console.log("ok");
      xhr.onload = () => {
        console.log(`第次`);
        if (xhr.status == 200) {
          let obj = JSON.parse(xhr.responseText);
          console.log(obj);
          let html = "";
          obj.Data.forEach((v) => {
            console.log(v.ID);
            html += `
                    <li><img src="${v.FaceSrc}" /></li>
                    `;
          });
          document.querySelector(".wrap ul").innerHTML += html;
        }
      };
    }
    let page = 1;
    createFn();
    function Next() {
      page++;
      createFn(page);
    }
  </script>
</html>
